﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace LearnThemselvesEffectively.Classes
{
    public abstract class TranslationCore
    {
        public TranslationCore()
        {
            miID = 0;
            WordsInStage = new List<GlobalSupportModele.TranslateItem>();
            msWarningMessage = "Do you really want to finish exam session?" + Environment.NewLine + Environment.NewLine + "Your progress will be abandoned!";
        }

        #region Fields and properties

        public List<GlobalSupportModele.TranslateItem> WordsInStage;

        private int miID;
        public int CurrentWordID
        {
            get { return miID; }
            set { miID = value; }
        }
                
        protected string msWarningMessage;
        public string WarningMessage
        {
            get { return msWarningMessage; }
        }

        public GlobalSupportModele.TranslateItem CurrTranstationItem
        {
            get { return WordsInStage.Find(o => (o.ID == miID)); }
        }
        #endregion

        #region Casual methods
        /// <summary>
        /// Chect if imputed word is correct
        /// </summary>
        /// <param name="inputedWord"></param>
        /// <param name="expected"></param>
        /// <returns>true if yes</returns>
        public bool CheckTranslation(string inputed)
        {
            if (string.Compare(inputed, CurrTranstationItem.Translation, StringComparison.CurrentCultureIgnoreCase) == 0) return true;
            else return false;
        }

        public string GetBaseWord()
        {
            return CurrTranstationItem.BaseWord;
        }
        #endregion

        #region Abstract methods
        public abstract void NextWord();
        #endregion
    }
}
